<?php
ob_start();
session_start();
include '../operations/connection.php';

if(!$_SESSION['user'])
{
	header( 'Location: login.php' );
}
else
{
	$username = $_SESSION['fullname'];
	$id_employee = $_SESSION['IDEmployee'];
}


$a= (string)(microtime(true)*1000);
$b=split('\.',$a);
$idtestproject= $b[0];
$idproject = $_REQUEST['id'];

$titleerror = $_REQUEST['titleerror'].'-%$#@!-#'.$_REQUEST['titleerrorhidden'];
$contenterror = $_REQUEST['ncontent'];
//$timeDate=date("Y-m-d H:i:s");
$status = 0;
$delete = 0;
$idtestpro = $_REQUEST['idtestproject'];

if(isset($_REQUEST['addnewerror'])){
	$sql ="INSERT INTO pr_testproject(IDTest,IDProject,IDEmployee,Title,TextTest,Time,`Status`,`Delete`) 
	 VALUES('$idtestproject','$idproject','$id_employee','$titleerror','$contenterror',NOW(),'$status','$delete')";
	
	mysql_query($sql);
}else if($_REQUEST['update']){
	$sql ="UPDATE pr_testproject SET Title = '$titleerror', TextTest = '$contenterror' WHERE IDTest = '$idtestpro'";
	mysql_query($sql);
}
?>
<?php 
mysql_close($connection);


if(isset($_REQUEST['addnewerror'])||isset($_REQUEST['update'])){
		header("Location: ../project.php?projectDetail=project-detail&id=$idproject");
}
ob_flush();
?>
